#ifndef Singleton_h__
#define Singleton_h__

#include "Memory.h"

namespace le
{
	template <typename T>
	class Singleton
	{
		#ifdef _WIN32
		friend typename T;
		#else
		friend T;
		#endif
	public:
		virtual ~Singleton() { m_Instance = 0; }

		static void _SdmInit() {m_Instance = LeNew T();}
		static void _SdmShutDown() {LeDelete(m_Instance);}

		static T* GetInstance() {return m_Instance;}

	protected:
		Singleton() {}

	private:
		static T* m_Instance;
	};

	template <typename T>
	T* Singleton<T>::m_Instance;
}

#endif // Singleton_h__
